<template>
	<div class="box" style="height: 100%;">
		<el-table :data="state.tableData" style="width: 100%" height="100%">
			<el-table-column show-overflow-tooltip prop="projectName" label="项目" />
			<el-table-column
				show-overflow-tooltip
				prop="investmentProfit"
				label="投资收益"
			/>
			<el-table-column show-overflow-tooltip prop="investmentScale" label="投资规模" />
			<el-table-column show-overflow-tooltip prop="investmentRatio" label="投资比例">
			</el-table-column>
		</el-table>
	</div>
</template>

<script setup>
import { reactive, onMounted, watch } from "vue";
import { ElTable } from "element-plus";
import {cockpitApi} from "@/api/investment";

const props = defineProps({
	year:{
		type:String,
		default:()=>{
			let date = new Date(); // 获取时间
			return  date.getFullYear() // 获取年
		}
	}
});

const state = reactive({
	tableData: [],
});

const handel = () => {};

/**
 * 投资收益快报
 * @param year
 */
const getProjectProfit = (year) => {
	cockpitApi.getProjectProfit({year:year}).then(res=>{
		if(res.code === '200'){
			state.tableData = res.data;
		}
	});
}

/**
 * 搜索
 */
const onSearch = () => {
	getProjectProfit(props.year);
}

defineExpose({
	onSearch
});

onMounted(() => {
	getProjectProfit(props.year);
});
</script>
<style lang="scss" scoped>
.el-table{
	:deep(.el-table__header-wrapper .el-table__header .el-table__cell .cell) {
		font-size: 12px;
		font-family: SourceHanSansCN-Normal, SourceHanSansCN;
		font-weight: 400;
		color: #666666;
		line-height: 18px;
	}
}

:deep(.el-table__cell) {
	padding: 0px;

	:deep(.cell) {
		// color: #1a1a1a;
		color: pink;
	}
}
</style>
